package com.ric.controller.sysuser;

import com.ric.dao.model.sysUser.SysUser;
import com.ric.service.sysuser.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2017/5/26.
 */
@Controller
@RequestMapping("/sys/user")
public class SysUserController {
    @Autowired
    private SysUserService sysUserService;

    @RequestMapping("/login")
    public String login(Model model){
        SysUser user = new SysUser();
        user.setStatus(1);
        user.setPassword("123");
        user.setUserName("测试");
        try {
            //sysUserService.addUser(user);
        } catch (Exception e) {
            e.printStackTrace();
        }
        Map<String,String> map = new HashMap<String,String>();
        map.put("1","1");
        model.addAttribute("abc","测试thymeleaf成功");
        return "user/login";
    }

    /*
    * 初始化进入登录页面
    * */
    @RequestMapping(value = "/logintest",method = RequestMethod.GET)
    public String toLogintodo(Model model) {
        model.addAttribute("msg",sysUserService.listAllResource("1"));
        return "public/login1";
    }
}
